Computer processor with instruction for execution based on available instruction sets

ABSTRACT

A system and method for testing whether a computer processor is capable of executing a requested instruction set. The system includes a computer processor configured to receive an encoded conditional branch instruction in a form of machine code executable directly by the computer processor, and implement the encoded conditional branch instruction unconditionally, based on underlying hardware architecture of the computer processor. The Method for testing whether a computer processor is capable of executing a requested instruction set, the method including, receiving an encoded conditional branch instruction in a form of machine code executable directly by the computer processor, and implementing the encoded conditional branch instruction unconditionally, based on underlying hardware architecture of the computer processor.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation application of and claims priorityunder 35 U.S.C. §120 to U.S. patent application Ser. No. 13/719,537 (“ACOMPUTER PROCESSOR WITH INSTRUCTION FOR EXECUTION BASED ON AVAILABLEINSTRUCTION SETS”) filed Dec. 19, 2012.

BACKGROUND

Present invention relates to computer processor, and more particularlyto a system and method for testing whether a computer processor iscapable of executing a requested instruction set.

Hardware architectures are continually evolving. For example, the IBMz/Architecture has its roots in the System/360, announced in 1964, andhas been continually evolving. The most recent upgrade to z/Architectureincludes more than 100 new CPU instructions, most of them designed toprovide better execution performance to application programs. Many othercomputer processor architectures follow a similar evolution path.

Such new facilities present a problem to software product developers: itis not possible for software products to easily exploit the newfacilities. Shortly after a new facility is announced, most of theinstalled machines will be older versions of the architecture and thus,unable to run software that uses the new facility. Any software productthat has the new version of architecture as prerequisite will have avery small market. Only after some time (a few years) will most of theinstalled machines support the new instructions.

BRIEF SUMMARY

One example of the present invention is a system for testing whether acomputer processor is capable of executing a requested instruction set.The system includes a computer processor configured to receive anencoded conditional branch instruction in a form of machine codeexecutable directly by the computer processor, and implement the encodedconditional branch instruction unconditionally, based on underlyinghardware architecture of the computer processor.

Yet another example of the present invention is a method for testingwhether a computer processor is capable of executing a requestedinstruction set. The method includes receiving an encoded conditionalbranch instruction in a form of machine code executable directly by thecomputer processor, and implementing the encoded conditional branchinstruction unconditionally, based on underlying hardware architectureof the computer processor.

A further example of the present invention is a computer program productfor testing whether a computer processor is capable of executing arequested instruction set. The computer program product includescomputer readable program code configured to: receive an encodedconditional branch instruction in a form of machine code executabledirectly by the computer processor; and implement the encodedconditional branch instruction unconditionally, based on underlyinghardware architecture of the computer processor.

BRIEF DESCRIPTION OF THE DRAWINGS

The subject matter which is regarded as the invention is particularlypointed out and distinctly claimed in the claims at the conclusion ofthe specification. The foregoing and other objects, features, andadvantages of the invention are apparent from the following detaileddescription taken in conjunction with the accompanying drawings inwhich:

FIG. 1 shows method for testing whether a computer processor is capableof executing a requested instruction set in accordance with oneembodiment of the present invention.

FIG. 2 shows a system for testing whether a computer processor iscapable of executing a requested instruction set.

FIG. 3 shows another embodiment of method for testing whether a computerprocessor is capable of executing a requested instruction set inaccordance with one embodiment of the present invention.

FIG. 4 shows an embodiment of the encoded conditional instructionformat.

DETAILED DESCRIPTION

The present invention is described with reference to embodiments of theinvention. Throughout the description of the invention reference is madeto FIGS. 1-4. When referring to the figures, like structures andelements shown throughout are indicated with like reference numerals.

FIG. 1 shows method for testing whether a computer processor is capableof executing a requested instruction set in accordance with oneembodiment of the present invention. As used herein, the terminstruction set may also be referred to as a facility. The methodincludes an encoding step 102.

During the encoding step 102, a compiler or an assembler receives aconditional execution code and generates an encoded conditional branchinstruction in the form of machine code executable directly by thecomputer processor. After the encoding step 102 is completed, the methodcontinues to receiving step 104.

At the receiving step 104, the computer processor receives the encodedconditional branch instruction in a form of machine code executabledirectly by the computer processor. After the receiving step 104 iscompleted, the method continues to implementing step 106.

At the implementing step 106, the encoded conditional branch instructionis implemented unconditionally, based on underlying hardwarearchitecture of the computer processor. In one embodiment, the decodingstep 106 includes updating a program counter of the computer processorwith an unconditional branch address if the computer processor iscapable of executing the requested instruction set. As used herein, theterm program counter may also be referred to as a PSW.

FIG. 2 shows a system 200 for testing whether a computer processor iscapable of executing a requested instruction set. The system 200includes a computer processor 208, and a compiler 210, or an assembler212.

The compiler 210 or assembler 212 is configured to receive a conditionalexecution code and generate the encoded conditional branch instructionin the form of machine code executable directly by the computerprocessor.

The encoded conditional branch instruction 201 is in a bit array formatcomprising of an operation code field 202, an instruction set indexfield 204, and a relative instruction address field 206. The operationcode field 202 represents the encoded conditional branch instruction201. The instruction set index field 204 contains an index value into aninstruction set array 214. As used herein, the term instruction setarray may also be referred to as a facility array. The relativeinstruction address field 206 contains an offset address for updatingthe branch address 216 of the program counter 218.

The computer processor 208 includes a program counter 218 andinstruction set array 214. The instruction set array 214 contains bitvalue indicating whether an instruction set is executable by thecomputer processor.

The computer processor 208 may receive the encoded conditional branchinstruction 201 in a form of machine code executable directly by thecomputer processor 208 and may implement the encoded conditional branchinstruction 201 unconditionally, based on underlying hardwarearchitecture of the computer processor 208.

In one embodiment, decoding the encoded conditional branch instruction201 includes updating a program counter 218 of the computer processor208 with an unconditional branch address 216 if the computer processor208 is capable of executing the requested instruction set.

In one embodiment, the program counter 218 is updated by adding theoffset address when the bit value of the instruction set array 214corresponding with the index value of the instruction set index fieldis 1. In another embodiment, the program counter 218 is updated byadding the offset address when the bit value of the instruction setarray 214 corresponding with the index value of the instruction setindex field is 0.

FIG. 3 shows another embodiment of method for testing whether a computerprocessor is capable of executing a requested instruction set inaccordance with one embodiment of the present invention. According tothis embodiment, the method includes a determining step 302.

During the determining step 302, the determining if the computerprocessor is capable of executing the instruction set includes checkingthe bit value of instruction set array that corresponds with index valueof the instruction set index field. After the determination step 302 iscompleted, the method continues to an updating step 304.

At updating step 304, the program counter is updated by adding theoffset address, according to the determination of the determining step302. In one embodiment, the program counter is updated when the bitvalue of the instruction set array corresponding with the index value ofthe instruction set index field is 1. In another embodiment, the programcounter is updated when the bit value of the instruction set arraycorresponding with the index value of the instruction set index field is0. After the updating step 304 is completed, the method continues to abranch step 306.

At branch step 306, the instruction sequencing proceeds with theinstruction address in the program counter.

Accordingly, one embodiment of the invention may use the z/Architectureas an example. Such embodiment may contain a bit array in memory for afacility array, with one bit representing each available facility (thisalready exists in z/Architecture). New instructions are to check a bitin the Facility Array and branch to a designated relative instructionaddress depending on whether the bit checked is 1 or 0. Theseinstructions may be called BFA (Branch on Facility Available) and BFNA(Branch on Facility Not Available).

In z/Architecture example, the BFA/BFNA instruction may be in a SIL(storage-and-immediate operation, with a 16-bit immediate field) format.

FIG. 4 shows an embodiment of the SIL format 402. The SIL format 402 maycomprise of an Op code field 404 that holds the operation code, B₁ field406 with value always ‘0,’ D₁ field 408 which may be an unsigned integerthat functions as an index into the Facility Array, and I₂ field 410that holds a Relative instruction address.

In one embodiment of the invention, the index operand (D₁) may be12-bit, and provide index for 4096 different facilities, which should beenough, even for a long-lived architecture, given the fact that thehighest facility bit currently assigned in z/Architecture is 77.

Proposed embodiment of instruction operation may work as follows: theinstruction address in the current PSW is replaced by the branch addressif the Facility Array bit indicated by D₁ is one (for BFA) or zero (forBFNA); otherwise, normal instruction sequencing proceeds with theupdated instruction address. The contents of the D₁ field may be anunsigned binary integer specifying an index into the Facility Array. Thecontents of the I₂ field may be a signed binary integer specifying thenumber of halfwords that is added to the address of the instruction togenerate the branch address.

Traditional test instructions had following problems:

1. The Test (TM) instruction alters the condition code. It may benecessary to save it prior to making the test (and restore itafterwards).

2. The test/branch technique contains a conditional branch which ispotentially disruptive to processor pipelines and/or requires branchprediction.

3. It may not be worth optimizing the code for short sequences ofinstructions (the addition of the Test and Branch instructions maynegate the CPU savings from using new instructions).

According to the embodiment of this invention, the conditional executioncode from a software programmer's perspective does not change by theinstructions, but BFA and BFNA are effectively unconditional branches onany given machine, and are hence pipeline-friendly.

The difference with other approach is that the proposed instructions arevery simple, and it should be easy to add them to existing machines viaa microcode upgrade.

As will be appreciated by one skilled in the art, aspects of the presentinvention may be embodied as a system, method or computer programproduct. Accordingly, aspects of the present invention may take the formof an entirely hardware embodiment, an entirely software embodiment(including firmware, resident software, microcode, etc.) or anembodiment combining software and hardware aspects that may allgenerally be referred to herein as a “circuit,” “module” or “system.”Furthermore, aspects of the present invention may take the form of acomputer program product embodied in one or more computer readablemedium(s) having computer readable program code embodied thereon.

Any combination of one or more computer readable medium(s) may beutilized. The computer readable medium may be a computer readable signalmedium or a computer readable storage medium. A computer readablestorage medium may be, for example, but not limited to, an electronic,magnetic, optical, electromagnetic, infrared, or semiconductor system,apparatus, or device, or any suitable combination of the foregoing. Morespecific examples (a non-exhaustive list) of the computer readablestorage medium would include the following: an electrical connectionhaving one or more wires, a portable computer diskette, a hard disk, arandom access memory (RAM), a read-only memory (ROM), an erasableprogrammable read-only memory (EPROM or Flash memory), an optical fiber,a portable compact disc read-only memory (CD-ROM), an optical storagedevice, a magnetic storage device, or any suitable combination of theforegoing. In the context of this document, a computer readable storagemedium may be any tangible medium that can contain, or store a programfor use by or in connection with an instruction execution system,apparatus, or device.

A computer readable signal medium may include a propagated data signalwith computer readable program code embodied therein, for example, inbaseband or as part of a carrier wave. Such a propagated signal may takeany of a variety of forms, including, but not limited to,electromagnetic, optical, or any suitable combination thereof. Acomputer readable signal medium may be any computer readable medium thatis not a computer readable storage medium and that can communicate,propagate, or transport a program for use by or in connection with aninstruction execution system, apparatus, or device.

Program code embodied on a computer readable medium may be transmittedusing any appropriate medium, including but not limited to wireless,wireline, optical fiber cable, RF, etc., or any suitable combination ofthe foregoing.

Computer program code for carrying out operations for aspects of thepresent invention may be written in any combination of one or moreprogramming languages, including an object oriented programming languagesuch as Java, Smalltalk, C++ or the like and conventional proceduralprogramming languages, such as the “C” programming language or similarprogramming languages. The program code may execute entirely on theuser's computer, partly on the user's computer, as a stand-alonesoftware package, partly on the user's computer and partly on a remotecomputer or entirely on the remote computer or server. In the latterscenario, the remote computer may be connected to the user's computerthrough any type of network, including a local area network (LAN) or awide area network (WAN), or the connection may be made to an externalcomputer (for example, through the Internet using an Internet ServiceProvider).

Aspects of the present invention are described below with reference toflowchart illustrations and/or block diagrams of methods, apparatus(systems) and computer program products according to embodiments of theinvention. It will be understood that each block of the flowchartillustrations and/or block diagrams, and combinations of blocks in theflowchart illustrations and/or block diagrams, can be implemented bycomputer program instructions. These computer program instructions maybe provided to a processor of a general purpose computer, specialpurpose computer, or other programmable data processing apparatus toproduce a machine, such that the instructions, which execute via theprocessor of the computer or other programmable data processingapparatus, create means for implementing the functions/acts specified inthe flowchart and/or block diagram block or blocks.

These computer program instructions may also be stored in a computerreadable medium that can direct a computer, other programmable dataprocessing apparatus, or other devices to function in a particularmanner, such that the instructions stored in the computer readablemedium produce an article of manufacture including instructions whichimplement the function/act specified in the flowchart and/or blockdiagram block or blocks.

The computer program instructions may also be loaded onto a computer,other programmable data processing apparatus, or other devices to causea series of operational steps to be performed on the computer, otherprogrammable apparatus or other devices to produce a computerimplemented process such that the instructions which execute on thecomputer or other programmable apparatus provide processes forimplementing the functions/acts specified in the flowchart and/or blockdiagram block or blocks.

The flowchart and block diagrams in the Figures illustrate thearchitecture, functionality, and operation of possible implementationsof systems, methods and computer program products according to variousembodiments of the present invention. In this regard, each block in theflowchart or block diagrams may represent a module, segment, or portionof code, which comprises one or more executable instructions forimplementing the specified logical function(s). It should also be notedthat, in some alternative implementations, the functions noted in theblock may occur out of the order noted in the figures. For example, twoblocks shown in succession may, in fact, be executed substantiallyconcurrently, or the blocks may sometimes be executed in the reverseorder, depending upon the functionality involved. It will also be notedthat each block of the block diagrams and/or flowchart illustration, andcombinations of blocks in the block diagrams and/or flowchartillustration, can be implemented by special purpose hardware-basedsystems that perform the specified functions or acts, or combinations ofspecial purpose hardware and computer instructions.

The descriptions of the various embodiments of the present inventionhave been presented for purposes of illustration, but are not intendedto be exhaustive or limited to the embodiments disclosed. Manymodifications and variations will be apparent to those of ordinary skillin the art without departing from the scope and spirit of the describedembodiments. The terminology used herein was chosen to best explain theprinciples of the embodiments, the practical application or technicalimprovement over technologies found in the marketplace, or to enableothers of ordinary skill in the art to understand the embodimentsdisclosed herein.

What is claimed is:
 1. A computer program product for testing whether acomputer processor is capable of executing a requested instruction set,the computer program product comprising: a non-transitory computerreadable storage medium having computer readable program code embodiedtherewith, the computer readable program code configured to: receive anencoded conditional branch instruction in a form of machine codeexecutable directly by the computer processor; and implement the encodedconditional branch instruction unconditionally, based on underlyinghardware architecture of the computer processor; wherein implementingthe encoded conditional branch instruction includes updating a programcounter of the computer processor with an unconditional branch addressif the computer processor is capable of executing the requestedinstruction set; wherein the computer processor further includes aninstruction set array that each bit value contained indicates whether aninstruction set is executable by the computer processor wherein theencoded conditional branch instruction is in a bit array formatcomprising: an operation code field representing the encoded conditionalbranch instruction; an instruction set index field containing an indexvalue into the instruction set array; and a relative instruction addressfield containing an offset address for updating the program counter;wherein the program counter is updated by adding the offset address whenthe corresponding bit value of the instruction set array is
 1. 2. Thecomputer program product of claim 1, wherein the encoded conditionalbranch instruction is generated from a conditional execution codereceived by a compiler or an assembler.
 3. A computer program productfor testing whether a computer processor is capable of executing arequested instruction set, the computer program product comprising: anon-transitory computer readable storage medium having computer readableprogram code embodied therewith, the computer readable program codeconfigured to: receive an encoded conditional branch instruction in aform of machine code executable directly by the computer processor; andimplement the encoded conditional branch instruction unconditionally,based on underlying hardware architecture of the computer processor;wherein implementing the encoded conditional branch instruction includesupdating a program counter of the computer processor with anunconditional branch address if the computer processor is capable ofexecuting the requested instruction set; wherein the computer processorfurther includes an instruction set array that each bit value containedindicates whether an instruction set is executable by the computerprocessor wherein the encoded conditional branch instruction is in a bitarray format comprising: an operation code field representing theencoded conditional branch instruction; an instruction set index fieldcontaining an index value into the instruction set array; and a relativeinstruction address field containing an offset address for updating theprogram counter; wherein the program counter is updated by adding theoffset address when the corresponding bit value of the instruction setarray is
 0. 4. The computer program product of claim 3, wherein theencoded conditional branch instruction is generated from a conditionalexecution code received by a compiler or an assembler.